package com.yuexunit.operationman.nbsy.module.BeforeAnesthesiaVisit.ui.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;


import com.yuexunit.operationman.nbsy.R;
import com.yuexunit.operationman.nbsy.config.AppConfig;
import com.yuexunit.operationman.nbsy.module.BeforeAnesthesiaVisit.bean.BeforeAnesthesiaBean;
import com.yuexunit.operationman.nbsy.module.BeforeAnesthesiaVisit.ui.Act_BeforeAnesthesiaPreview;

import org.kymjs.kjframe.ui.KJFragment;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by chenss on 2017/8/8 0008.
 */

public class Fragment_BA_Evaluate extends KJFragment {

    @Bind(R.id.frag_ba_eva_01)
    TextView fragBaEva01;
    @Bind(R.id.frag_ba_eva_02)
    TextView fragBaEva02;

    private Act_BeforeAnesthesiaPreview aty;
    protected View mMainView;

    @Override
    protected View inflaterView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
        aty = (Act_BeforeAnesthesiaPreview) getActivity();
        mMainView = inflater.inflate(R.layout.fragment_ba_evaluate, container, false);
        ButterKnife.bind(this, mMainView);
        return mMainView;
    }

    @Override
    protected void initData() {
        for(BeforeAnesthesiaBean.ObjectEntity.VisitItemsEntity p : AppConfig.BEFOREANSETHESIA.getObject().getVisitItems()) {
            switch (p.getItemCode()) {
                case "ASA":
                    String[] array = p.getItemValue().split(";");
                    String content = "";
                    for (int i = 0; i < array.length; i++) {
                        if (content.length() > 0) {
                            content += "\n";
                            content += array[i];
                        }
                        else {
                            content += array[i];
                        }
                    }
                    fragBaEva01.setText(content);
                    break;
            }
        }
        fragBaEva02.setText(AppConfig.BEFOREANSETHESIA.getObject().getVisit().getSugest());
    }
}
